global keepers1976 ""

numlabel, add

genl yr=1976
global keepers1976 $keepers1976 yr

genl id=v1
global keepers1976 $keepers1976 id

genl income=v282
genl income3=income
centile income, c(33 66 100)
replace income3=0 if income<=r(c_1)
centile income, c(33 66 100)
replace income3=1 if income>r(c_1) & income<=r(c_2)
centile income, c(33 66 100)
replace income3=2 if income>r(c_2) & income<=r(c_3)
global keepers1976 $keepers1976 income3

genl pid_ce=(v213==22 & v214==1)
replace pid_ce=. if v212==.
global keepers1976 $keepers1976 pid_ce

genl pid_gov=pid_ce
global keepers1976 $keepers1976 pid_gov

genl vote_ce=v228
recode vote_ce 22=1 .=. else=0
global keepers1976 $keepers1976 vote_ce

genl vote_gov=vote_ce==6
global keepers1976 $keepers1976 vote_gov

drop if v2~=4


genl gpi=v14
recode gpi 8=2.5
replace gpi=abs(gpi-4)/3
global keepers1976 $keepers1976 gpi

genl socref=v110
recode socref 8=2.5
replace socref=abs(socref-4)/3
global keepers1976 $keepers1976 socref

genl degree=v287
recode degree 7=1 1/6=0
global keepers1976 $keepers1976 degree


// Class/occupation

gen class_resp_3cat = v240
recode class_resp_3cat 1/7=3 10/25=2 30/40=1
replace class_resp_3cat = . if class_resp_3cat > 40
label variable class_resp_3cat "Social class (3 cats.): higher value is higher class"
*label define LblClassGrade 1 "A: (Higher man.; prof." 2 "B: Lower man.; admin." 3 "C1A: Skilled; supervis. non-manu." 4 "C1B: Lower non-manu." 5 "C2: Skilled manu." 6 "D: Unskilled manu."
*label values class_head_grade LblClassGrade
global keepers1976 $keepers1976 class_resp_3cat

gen class_spou_3cat = v254
recode class_spou_3cat 1/7=3 10/25=2 30/40=1
replace class_spou_3cat = . if class_spou_3cat > 40
label variable class_spou_3cat "Social class (3 cats.): higher value is higher class"
*label define LblClassGrade 1 "A: (Higher man.; prof." 2 "B: Lower man.; admin." 3 "C1A: Skilled; supervis. non-manu." 4 "C1B: Lower non-manu." 5 "C2: Skilled manu." 6 "D: Unskilled manu."
*label values class_head_grade LblClassGrade
global keepers1976 $keepers1976 class_spou_3cat

gen class_reho_3cat_strata = v283
recode class_reho_3cat_strata 1=1 2=1 3=2 4=2 5=1 6=2 7=2 8=.
replace class_reho_3cat_strata = . if class_reho_3cat_strata > 40
label variable class_reho_3cat_strata "Social class (3 cats.): higher value is higher class"
*label define LblClassGrade 1 "A: (Higher man.; prof." 2 "B: Lower man.; admin." 3 "C1A: Skilled; supervis. non-manu." 4 "C1B: Lower non-manu." 5 "C2: Skilled manu." 6 "D: Unskilled manu."
*label values class_head_grade LblClassGrade
global keepers1976 $keepers1976 class_reho_3cat_strata



gen male = v281
recode male 1=1 2=0
global keepers1976 $keepers1976 male

gen married = v251
recode married 1=1 2/3=0 9=.
global keepers1976 $keepers1976 married

gen unionmem_resp = v245
recode unionmem_resp 1/4=1 .=0
global keepers1976 $keepers1976 unionmem_resp

gen unionmem_spou = v259
recode unionmem_spou 1/4=1 .=0
global keepers1976 $keepers1976 unionmem_spou



// Pascal/SM moderators

 foreach var of varlist  v129 v130 v131 v132 v133 v134 v135 v136 v137 v138{
        gen Z`var'=`var'
		replace Z`var'=1 if `var'==1
		replace Z`var'=0.75 if `var'==2
		replace Z`var'=0.5 if `var'==8 | `var'==3
		replace Z`var'=0.25 if `var'==4
		replace Z`var'=0 if `var'==5
		tab Z`var' `var', m
  }

***Translation unclear
rename Zv129 influence_landsorganisationen
lab var  influence_landsorganisationen "1=country organization  have to much influence" 

***translation unclear
rename Zv130 influence_central
lab var  influence_central "1=central official  have to much influence" 

rename Zv131 influence_employers
lab var  influence_employers "1= employers' Confederation have to much influence" 

rename Zv132 influence_largebusiness
lab var  influence_largebusiness "1=Large business  have to much influence" 

rename Zv133 influence_smallbusinesses
lab var  influence_smallbusinesses "1=small businesses have to much influence" 

rename Zv134 influence_localunions
lab var  influence_localunions "1=local unions  have to much influence" 

rename Zv135 influence_officials
lab var  influence_officials "1=officials  have to much influence" 

rename Zv136 influence_workers
lab var  influence_workers "1=workers  has to much influence" 

rename Zv137 influence_farmers
lab var  influence_farmers "1=farmers  has to much influence" 

rename Zv138 influence_politicians
lab var  influence_politicians "1=politicians  has to much influence" 


    gen party_ID=. 
   replace party_ID=1 if v212==1 & v213==11
   replace party_ID=2 if v212==1 & v213==22
   replace party_ID=3 if v212==1 & v213==33
   replace party_ID=4 if v212==1 & v213==44
  
   replace party_ID=6 if v212==1 & v213==66
   replace party_ID=7 if v212==1 & v213==87

   replace party_ID=8 if v212==1 & v213==88
   
   replace party_ID=9 if v212==1 & v213==12
 
   replace party_ID=10 if v212==1 & v213==55
 
 replace party_ID=11 if v212==1 & v213==13
 replace party_ID=12 if v212==1 & v213==71
 replace party_ID=13 if v212==1 & v213==72

 lab def party_ID 1 "v�nsterpartiet kom " 2 "socialdemokraterna" 3"centerpartiet" 4"folkpartiet" 5"h�gerpartiet" 6"kristen demokratis" 7 "other" 8 "will not answer"9 " kommunistiska f�rbundet marxist-len" 10 " moderata samlingspartiet " 11 "sveriges kommunis" 12 "borgerligt "  13 "FC+C" 14 "lokal borgerlig" 15 "sk�nepartiet" 16 "kommunistiska arbetaref�rbundet" 17 "vpk, apk, kpmlr, skp, kaf" 18 "gr�nt parti" 19 "ny demokrati"
 lab val party_ID party_ID
  tab party_ID, m
 tab party_ID v213, m

 foreach var of varlist v56 v57 v61 v64 v65 v66 v71{
        gen Z`var'=`var'
		replace Z`var'=5 if `var'==1
		replace Z`var'=4 if `var'==2
		replace Z`var'=3 if `var'==8 | `var'==3
		replace Z`var'=2 if `var'==4
		replace Z`var'=1 if `var'==5
		replace Z`var'=(Z`var'-1)/4
		tab Z`var' `var', m
  }


rename Zv56 emp_influence
lab var emp_influence "1=good idea to incrise employers influence" 

rename Zv57 reduce_control
lab var reduce_control "1=good idea to reduce gov influence on enterprises" 

rename Zv61 equality
lab var equality "1=good idea to Increase income and working conditions equality" 

rename Zv64 socialize
lab var socialize "1=good idea to socialize large industries" 

rename Zv65 red_tax_high
lab var red_tax_high "1=good idea to cut taxes on high incomes" 

rename Zv66 red_tax_low
lab var red_tax_low "1=good idea to cut taxes on low incomes" 

rename Zv71 red_tax_emp
lab var red_tax_emp "1=good idea to cut taxes on employers" 


foreach var of varlist v107 v108 v109 v110{
        gen Z`var'=`var'
		replace Z`var'=4 if `var'==1
		replace Z`var'=3 if `var'==2
		replace Z`var'=2.5 if `var'==8
		replace Z`var'=2 if `var'==3
		replace Z`var'=1 if `var'==4
		replace Z`var'=(Z`var'-1)/3
		tab Z`var' `var', m
  }

   rename Zv107 state_employment
  lab var state_employment "1=state intervention reduce unemployment risk"

    rename Zv108 no_state
  lab var no_state "1=enterprise perform better without state intervention"

    rename Zv109 econ_control
  lab var  econ_control "1=agree state control limit bank and industry influence"

rename Zv110 reduce_welfare
lab var reduce_welfare "1=central government should reduce social benefits"


  gen right=v220/100
replace right=0.50 if right>1 & right~=.
  tab right
  lab var right "1=far right"


  gen newspaper_politics=.
 replace newspaper_politics=0 if v13==1
 replace newspaper_politics=0.33 if v13==2
 replace newspaper_politics=0.66 if v13==3
 replace newspaper_politics=1 if v13==4
  replace newspaper_politics=0.5 if v13==8
tab newspaper_politics v13,m
	

 lab var newspaper_politics "1=read more politic articles"

 
 gen shareholder=(v111==1)
 replace shareholder=. if v111==.
 tab shareholder v111, m
  lab var shareholder "shareholder should own big large industry"
  
  gen government=(v111==2)
 replace government=. if v111==.
  tab government v111, m
  lab var government "government should own big large industry"

  
  
gen anti_econ_control=.
replace anti_econ_control=0.3333333 if econ_control>0.5 & econ_control<1
replace anti_econ_control=0.6666666 if econ_control>0 & econ_control<0.5
replace anti_econ_control=1 if econ_control==0
replace anti_econ_control=0.5 if econ_control==0.5
replace anti_econ_control=0 if econ_control==1
tab anti_econ_control econ_control, m

gen anti_state_employment=.
replace anti_state_employment=0.3333333 if state_employment>0.5 & state_employment<1
replace anti_state_employment=0.6666666 if state_employment>0 & state_employment<0.5
replace anti_state_employment=1 if state_employment==0
replace anti_state_employment=0.5 if state_employment==0.5
replace anti_state_employment=0 if state_employment==1
tab anti_state_employment state_employment, m

gen anti_influence_largebusiness=.
replace anti_influence_largebusiness=0 if influence_largebusiness==1
replace anti_influence_largebusiness=0.25 if influence_largebusiness==0.75
replace anti_influence_largebusiness=0.5 if influence_largebusiness==0.5
replace anti_influence_largebusiness=0.75 if influence_largebusiness==0.25
replace anti_influence_largebusiness=1 if influence_largebusiness==0
tab anti_influence_largebusiness influence_largebusiness, m

gen anti_emp_influence=.
replace anti_emp_influence=0 if emp_influence==1
replace anti_emp_influence=0.25 if emp_influence==0.75
replace anti_emp_influence=0.5 if emp_influence==0.5
replace anti_emp_influence=0.75 if emp_influence==0.25
replace anti_emp_influence=1 if emp_influence ==0
tab anti_emp_influence emp_influence , m



gen anti_socialize=.
replace anti_socialize=0 if socialize==1
replace anti_socialize=0.25 if socialize==0.75
replace anti_socialize=0.5 if socialize==0.5
replace anti_socialize=0.75 if socialize==0.25
replace anti_socialize=1 if socialize==0
tab anti_socialize socialize, m

gen index_interest=( gpi+ newspaper_politics )/2
global keepers1976 $keepers1976 index_interest

gen index_market_oriented=(socref +influence_landsorganisationen + anti_influence_largebusiness  + influence_workers + anti_emp_influence  + anti_socialize +red_tax_emp+ anti_state_employment +no_state +anti_econ_control +reduce_welfare+ right+ shareholder )/13
global keepers1976 $keepers1976 index_market_oriented
